package com.itl.train.controller;

import com.itl.train.entity.Company;
import com.itl.train.service.CompanyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 胡广
 * @date 2020-11-06
 * @since JDK1.8
 */
@RestController
@RequestMapping("company")
public class CompanyController {

    @Autowired
    private CompanyService companyService;

    @PostMapping("getByCodeAndName")
    public List<Company> getByCodeAndName(@RequestParam("code") String code, @RequestParam("name") String name) {
        return companyService.getByCodeAndName(code,name);
    }

    @PostMapping("getById/{id}")
    public Company getById(@PathVariable("id") String id) {
        return companyService.getById(id);
    }



    @PostMapping("query")
    public List<Company> query(@RequestBody Company company) {
        return companyService.query(company);
    }

}
